﻿using KernelSyntaxExample.Utils;
using Microsoft.SemanticKernel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SemanticKernelBlazorDemo.Shared.Services;

public class JudgeKeyService : IJudgeKeyService
{
    private IKernel _kernel;

    public JudgeKeyService(IKernelFactory kernelFactory)
    {
        _kernel = kernelFactory.Produce();
    }

    public string JudgeKeyeAsync(string ask)
    {
        var keyAnalysisSkill =
              _kernel.ImportSemanticSkillFromDirectory(
                  ProjectFile.GetSkillsFolder(), "KeyAnalysisSkill");
        return _kernel.RunAsync(ask, keyAnalysisSkill["JudgeKeys"]).Result.ToString();
    }

    
}
